From: Juergen Gross Date: Wed, 23 Aug 2017 17:34:00 +0000 (+0200) Subject: xen/arch/x86/hvm/vmx/vmcs.c: let custom parameter parsing routines return errno X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1595 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=0a3465cfb2f604e0d6b6ee98a5acd2f2bdccbbb3;p=xen.git xen/arch/x86/hvm/vmx/vmcs.c: let custom parameter parsing routines return errno Modify the custom parameter parsing routines in: xen/arch/x86/hvm/vmx/vmcs.c to indicate whether the parameter value was parsed successfully. Signed-off-by: Juergen Gross Acked-by: Kevin Tian --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 86cd316cfb..f62fe7e217 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -74,9 +74,10 @@ static s8 __read_mostly opt_ept_ad = -1; * pml Enable PML * ad Use A/D bits */ -static void __init parse_ept_param(char *s) +static int __init parse_ept_param(const char *s) { - char *ss; + const char *ss; + int rc = 0; do { bool_t val = !!strncmp(s, "no-", 3); @@ -85,16 +86,20 @@ static void __init parse_ept_param(char *s) s += 3; ss = strchr(s, ','); - if ( ss ) - *ss = '\0'; + if ( !ss ) + ss = strchr(s, '\0'); - if ( !strcmp(s, "pml") ) + if ( !strncmp(s, "pml", ss - s) ) opt_pml_enabled = val; - else if ( !strcmp(s, "ad") ) + else if ( !strncmp(s, "ad", ss - s) ) opt_ept_ad = val; + else + rc = -EINVAL; s = ss + 1; - } while ( ss ); + } while ( *ss ); + + return rc; } custom_param("ept", parse_ept_param);